package dao

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Name string `gorm:"type:varchar(20);not null;comment:名称"`
	Pass string `gorm:"type:varchar(40);not null;comment:密码"`
}

func (User) TableName() string {
	return "user"
}

type Vote struct {
	gorm.Model
	Ticket string  `gorm:"type:varchar(20);not null;comment:什么票"`
	State  int     `gorm:"type:tinyint(1);not null;comment:状态:1-有票,2-无票"`
	Num    int     `gorm:"type:int(11);not null;comment:数量"`
	Seat   string  `gorm:"type:varchar(20);not null;comment:位置类型"`
	Price  float64 `gorm:"type:decimal(10,2);not null;comment:价格"`
}

func (Vote) TableName() string {
	return "vote"
}

type Order struct {
	gorm.Model
	OrderId int     `gorm:"type:int(11);not null;comment:订单id"`
	UserId  int     `gorm:"type:int(11);not null;comment:用户id"`
	VoteId  int     `gorm:"type:int(11);not null;comment:票id"`
	Money   float64 `gorm:"type:decimal(10,2);not null;comment:钱"`
}

func (Order) TableName() string {
	return "order"
}

type BuyTickets struct {
	gorm.Model
	UserId int     `gorm:"type:int(11);not null;comment:用户id"`
	VoteId int     `gorm:"type:int(11);not null;comment:票id"`
	Ticket string  `gorm:"type:varchar(20);not null;comment:什么票"`
	Money  float64 `gorm:"type:decimal(10,2);not null;comment:钱"`
	Seat   string  `gorm:"type:varchar(20);not null;comment:位置类型"`
}

func (BuyTickets) TableName() string {
	return "buyTickets"
}
